<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.7/iconfont.css" rel="stylesheet" type="text/css" />
<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<style type="text/css">
	label.col-2{width: 120px;}
	
	/*缩略图展示*/
	.uploader-blank{padding-top: 15px; width:158px;}
	.uploader-list{margin-bottom: 3px; position: relative;}
	.uploader-list img{height: 100px; width: 145px; border:#ccc 1px solid; padding: 3px;}
	.uploader-list .item{display: inline-block; text-align: center; position: relative; width: 157px;}
	.uploader-list .item .pic-box{border: #f0ecec 1px solid;}
	.uploader-list .item .state{position: absolute; bottom: -8px; text-align: center; background-color: #000; opacity: 0.6; color: #fff; padding: 1% 5%; width: 90%; overflow: hidden;}
	#filePicker{float: inherit;}

	/*附件列表*/
	.fujian{display: block; width: 100%;}
	.fujian li{list-style: none; width: auto; height: 50px; float: left; margin-right: 30px; position: relative; display: flex;}
	.fujian li img{width: 30px; height: 30px;}
	.fujian li i{ font-size: 18px; margin-left: 10px; margin-top: 2px; cursor: pointer;}
	.fujian li p{font-size: 12px; margin-left: 3px; line-height: 30px;}
	
	
	#slimg{position: absolute; bottom: 0px; left: 0px; width: 100%; height: 30px;}

	#autocomplate{
		position: absolute; top: 40px; width: 100%; border-radius: 5px; 
		display: none; background-color: #ddd; z-index: 1000; 
	}
	#autocomplate li{list-style: none; border-bottom: #fff 1px dashed; line-height: 35px; padding:0px 5px; cursor: pointer;}
	#autocomplate li:active{background-color: #fff; color: #333;}
	#autocomplate li:hover{background-color: #fff; color: #333;}
	#shoplist span{ padding: 3px 5px; border:#f37b1d 1px solid; border-radius: 3px; margin-right: 5px; color: #f37b1d; font-size: 12px; cursor:pointer;}

	#tuanservice label{
		margin-right: 10px;
	}
	
</style>
<title>新增专题</title>
</head>
<body>
<div class="pd-20">
	<form action="" method="post" class="form form-horizontal" id="form1">
		<div class="row cl">
			<label class="form-label col-2"><span class="c-red">*</span>专题标题：</label>
			<div class="formControls col-6">
				<input type="text" class="input-text" value="" placeholder="" id="art_title" name="art_title" nullmsg="专题标题不能为空！" datatype="s1-100">
			</div>
			<div class="col-3"> </div>
			<!-- <div class="btn btn-secondary-outline radius col-2">检测重复</div> -->
		</div>
		
		
		<!-- <div class="row cl">
			<label class="form-label col-2">栏目：</label>
			<div class="formControls col-3"> <span class="select-box">
				<select name="cid" class="select" id="cid">
				</select>
				</span> 
			</div>
			<label class="form-label col-2">发布日期：</label>
			<div class="formControls col-3">
				<input class="input-text datainp" id="article_time" type="text" name="article_time" value="" >
				
			</div>
			
			<label class="form-label col-2">排序值：</label>
			<div class="formControls col-1">
				<input type="text" class="input-text" value="" placeholder="" id="article_sort" name="article_sort">
			</div>
			
		</div> -->
		
		

		<!-- <div class="row cl">
			<label class="form-label col-2">推荐位置：</label>
			<div class="col-10">
				<div class="check-box">
				    <input type="checkbox" id="checkbox-1">
				    <label for="checkbox-1" class="lh-26">首页</label>
				</div>
				<div class="check-box">
				    <input type="checkbox" id="checkbox-2">
				    <label for="checkbox-2" class="lh-26">列表页</label>
				</div>
				<div class="check-box">
				    <input type="checkbox" id="checkbox-3">
				    <label for="checkbox-3" class="lh-26">详情页</label>
				</div>
				<div class="check-box">
				    <input type="checkbox" id="checkbox-4">
				    <label for="checkbox-4" class="lh-26">登陆页面</label>
				</div>
			</div>
		</div>	 -->
			
			
		
		<div class="row cl">
			<div class="col-9">
				<div class="row cl">
					<label class="form-label col-2">关联商品：</label>
					<div class="formControls col-8" style="position: relative;">
						<input type="text" class="input-text" value="" placeholder="" id="searchshopinput" onfocus="opensearch()" onblur="setTimeout(closesearch,200)" autocomplete="off" nullmsg="运费模板不能为空！">
						<input type="hidden" name="art_gid">
						<div id="autocomplate" class="thinklist">
							
						</div>
					</div>
				</div>
				<!-- <div class="row cl">
					<label class="form-label col-2">跳转链接：</label>
					<div class="formControls col-8">
						<input type="text" class="input-text" value="" placeholder="http://" id="art_url" name="art_url">
					</div>
					
				</div> -->
				<div class="row cl">
					<label class="form-label col-2">状态：</label>
					<div class="formControls col-3 s-msg">
					    <div class="radio-box">
					        <input type="radio" id="radio-1" name="art_state" value="1" checked>
					        <label for="radio-1" class="lh-26">显示</label>
					    </div>
					    <div class="radio-box">
					        <input type="radio" id="radio-2" name="art_state" value="0">
					        <label for="radio-2" class="lh-26">不显示</label>
					      </div>
					</div>
					
				</div>
				<div class="row c1">
					<label class="form-label col-2">浏览量：</label>
					<div class="formControls col-1">
						<input type="text" class="input-text" value="" placeholder="" id="art_click" name="art_click">
					</div>
				</div>
			</div>
			
			
		</div>
		

		<div class="row cl">
			<label class="form-label col-2">专题内容：</label>
			<div class="formControls col-10"> 
				<script id="editor" name="art_content" type="text/plain" ></script> 
			</div>
		</div>
		
		
	
		

		
</div>

<div class="row cl pr-20" style="position:fixed; bottom:10px; width: 200px; right: 10px; text-align: right; z-index:1000; ">
	
		<button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存</button>
		<button onClick="removeIframe();" class="btn btn-default radius" type="button" style="margin-left:10px;">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
	
</div>
</form>

<script type="text/javascript" src="lib/layer/2.1/layer.js"></script> 

<script type="text/javascript" src="lib/Validform/5.3.2/Validform.min.js"></script> 
<script type="text/javascript" src="lib/webuploader/0.1.5/webuploader.min.js"></script> 
<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.config.js"></script> 
<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.all.min.js"> </script> 
<script type="text/javascript" src="lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script> 
<script type="text/javascript" src="js/H-ui.js"></script> 
<script type="text/javascript" src="js/H-ui.admin.js"></script> 
<script type="text/javascript" src="js/template-native.js"></script> 
<script type="text/javascript" src="js/s.js"></script> 

<script type="text/javascript" src="lib/daterangepicker/moment.min.js"></script> 
<script type="text/javascript" src="lib/daterangepicker/jquery.daterangepicker.js"></script>
<link rel="stylesheet" href="lib/daterangepicker/daterangepicker.css" /> 



<script type="text/javascript">
var classinfo;//栏目信息-编辑


function removeIframe(){
	var index = parent.layer.getFrameIndex(window.name);
    parent.layer.close(index);
}

// 商家列表联想搜索
function autocomplate(){
    var input=$("#searchshopinput");
    if(window.prevKeywordVal === $(input).val() || $(input).val()==''){
        return false;
    }
    var html='';
    var api=API_GOODS+'?k='+$(input).val();
    var autocomplate='#autocomplate';
    $.getJSON(api,function(data){
        if(!checkStatus(data)) return;
        $(autocomplate).show().html('');
        for (x in data.datas){
            html+="<li data-name="+data.datas[x].goods_name+" data-id="+data.datas[x].goods_id+">"+data.datas[x].goods_id+": "+data.datas[x].goods_name+"</li>";
        }
        $(autocomplate).html(html);
    }); 
    if($(input).val()!==''){
    	prevKeywordVal=$(input).val(); 
    }
    // window.prevKeywordVal=$(input).val(); 
}

// 打开搜索列表
function opensearch() {
	$('#autocomplate').show();
	var html='';
	$.getJSON(API_GOODS,function(data){
		for (x in data.datas){
		    html+="<li data-name="+data.datas[x].goods_name+" data-id="+data.datas[x].goods_id+">"+data.datas[x].goods_id+": "+data.datas[x].goods_name+"</li>";
		}
		$('#autocomplate').html(html);
	})
	intervalId=setInterval('autocomplate()',500);
}
// 关闭搜索框
function closesearch(){
	$('#autocomplate').hide();
	clearInterval(intervalId);

}

// 选择商品模板
$(document).on('click','#autocomplate li',function(){
var id=$(this).data("id");
var name=$(this).data("name");

$("#searchshopinput").val('id:'+id+' '+name);
$("input[name=art_gid]").val(id);

})

 
$(function(){

	// $('#article_time').dateRangePicker(
	// {
	// 	autoClose: true,
	// 	singleDate : true,
	// 	showShortcuts: false,
	// 	singleMonth: true,


	// 	startOfWeek: 'monday',
	// 	format: 'YYYY-MM-DD HH:mm:ss',
	// 	time: {
	// 		enabled: true
	// 	},
	// 	defaultTime: moment().startOf('day').toDate(),
	// 	defaultEndTime: moment().endOf('day').toDate(),

	// });


	$("#form1").attr("action", API_ZHUANTI); 

	var editid=getUrlParam('editid');//编辑菜单id
	if(editid!==null){	     
	    var eidturl=API_ZHUANTI+"?id="+editid;
	    // 读取即将编辑的专题信息
	    $.getJSON(eidturl,function(data){

	    	if(!checkStatus(data)) return;//判断登录

	    	if(data.datas==''){
	    		layer.msg("数据加载错误", {icon:2,time:1000});
	    	}else{
	            $("#art_title").val(data.datas.art_title);

	            $("#art_click").val(data.datas.art_click);
	            $("#art_gid").val(data.datas.art_gid);
	            $("#searchshopinput").val(data.datas.art_gid+':'+data.datas.goods_name);

	            $("#art_url").val(data.datas.art_url);
	            $("#form1").attr("action", eidturl);

	        


                
	            classinfo=  data.datas.cid; //给栏目信息变量赋值

	            UE.getEditor('editor').addListener('ready', function (editor) {
		            UE.getEditor('editor').setContent(data.datas.art_content);
	            });



	            
	            if(data.datas.art_state=='0'){
	                $("#radio-2").attr("checked",true);
	                $("#radio-1").attr("checked",false);
	            }else{
	                $("#radio-1").attr("checked",true);
	                $("#radio-2").attr("checked",false);
	            }
	 
	        }
	    })
	}



	Validformsubmit("#form1");

	
	
	
	
	
	// 富文本编辑器
	getueidt()


});


// 移除选中的图片
function fj_close(obj){
	$(obj).parents("li").remove();
}


</script>
</body>
</html>